func void B_MM_AssessDamage()
{
	var C_Npc MagGol;
	var C_Npc ghostex;
	var C_Item OthWeap;
	var int sneakweaponindex;
	self.aivar[AIV_MM_PRIORITY] = PRIO_ATTACK;
	if(Hlp_GetInstanceID(other) == Hlp_GetInstanceID(sleeper))
	{
		if((Hlp_GetInstanceID(self) == Hlp_GetInstanceID(demonlord_li_1)) || (Hlp_GetInstanceID(self) == Hlp_GetInstanceID(demonlord_li_2)))
		{
			return;
		};
	};
	if((self.aivar[AIV_MM_REAL_ID] == ID_SUMMONED_DEMON) || (self.aivar[AIV_MM_REAL_ID] == ID_SUMMONED_WOLF) || (self.aivar[AIV_MM_REAL_ID] == ID_SUMMONED_GOBBO_SKELETON) || (self.aivar[AIV_MM_REAL_ID] == ID_SUMMONED_SKELETON) || (self.aivar[AIV_MM_REAL_ID] == ID_SummonedGuardian) || (self.aivar[AIV_MM_REAL_ID] == ID_SummonedZombie) || (self.aivar[AIV_MM_REAL_ID] == ID_SUMMONED_SWAMPDRONE) || (self.aivar[AIV_MM_REAL_ID] == ID_SUMMONED_GOLEM))
	{
		return;
	};
	if(Npc_IsPlayer(other))
	{
		if(ATR_STAMINA > 0)
		{
			if(Npc_IsInFightMode(other,FMODE_MELEE))
			{
				if(ATR_STAMINA > MELEEWEAPONINDEX)
				{
					ATR_STAMINA = ATR_STAMINA - MELEEWEAPONINDEX;
				}
				else
				{
					ATR_STAMINA = 0;
					Print(PRINT_LOWSTAMINA);
				};
			}
			else if(Npc_IsInFightMode(other,FMODE_FIST))
			{
				if(ATR_STAMINA > 1)
				{
					ATR_STAMINA = ATR_STAMINA - 1;
				}
				else
				{
					ATR_STAMINA = 0;
					Print(PRINT_LOWSTAMINA);
				};
			}
			else if(Npc_IsInFightMode(other,FMODE_FAR))
			{
				if(ATR_STAMINA > RANGEWEAPONINDEX)
				{
					ATR_STAMINA = ATR_STAMINA - RANGEWEAPONINDEX;
				}
				else
				{
					ATR_STAMINA = 0;
					Print(PRINT_LOWSTAMINA);
				};
			};
		}
		else if(other.attribute[ATR_HITPOINTS] < (other.attribute[ATR_HITPOINTS_MAX] / 4))
		{
			Print(PRINT_VERYLOWSTAMINA_03);
			if(Npc_IsInFightMode(other,FMODE_MELEE))
			{
				other.attribute[ATR_HITPOINTS] = other.attribute[ATR_HITPOINTS] - (MELEEWEAPONINDEX * 4);
			}
			else if(Npc_IsInFightMode(other,FMODE_FIST))
			{
				other.attribute[ATR_HITPOINTS] = other.attribute[ATR_HITPOINTS] - 4;
			}
			else if(Npc_IsInFightMode(other,FMODE_FAR))
			{
				other.attribute[ATR_HITPOINTS] = other.attribute[ATR_HITPOINTS] - (RANGEWEAPONINDEX * 4);
			};
		}
		else if(other.attribute[ATR_HITPOINTS] < (other.attribute[ATR_HITPOINTS_MAX] / 2))
		{
			Print(PRINT_VERYLOWSTAMINA_02);
			if(Npc_IsInFightMode(other,FMODE_MELEE))
			{
				other.attribute[ATR_HITPOINTS] = other.attribute[ATR_HITPOINTS] - (MELEEWEAPONINDEX * 2);
			}
			else if(Npc_IsInFightMode(other,FMODE_FIST))
			{
				other.attribute[ATR_HITPOINTS] = other.attribute[ATR_HITPOINTS] - 2;
			}
			else if(Npc_IsInFightMode(other,FMODE_FAR))
			{
				other.attribute[ATR_HITPOINTS] = other.attribute[ATR_HITPOINTS] - (RANGEWEAPONINDEX * 2);
			};
		}
		else if(other.attribute[ATR_HITPOINTS] < other.attribute[ATR_HITPOINTS_MAX])
		{
			Print(PRINT_VERYLOWSTAMINA_01);
			if(Npc_IsInFightMode(other,FMODE_MELEE))
			{
				other.attribute[ATR_HITPOINTS] = other.attribute[ATR_HITPOINTS] - MELEEWEAPONINDEX;
			}
			else if(Npc_IsInFightMode(other,FMODE_FIST))
			{
				other.attribute[ATR_HITPOINTS] = other.attribute[ATR_HITPOINTS] - 1;
			}
			else if(Npc_IsInFightMode(other,FMODE_FAR))
			{
				other.attribute[ATR_HITPOINTS] = other.attribute[ATR_HITPOINTS] - RANGEWEAPONINDEX;
			};
		};
	};
	if(Npc_IsPlayer(other) && Npc_IsInFightMode(self,FMODE_NONE) && (self.guild != GIL_DRAGON) && !Npc_CanSeeNpc(self,other) && (Npc_GetDistToNpc(self,other) <= PERC_DIST_ACTIVE_MAX) && (Npc_IsInFightMode(other,FMODE_MELEE) || Npc_IsInFightMode(other,FMODE_FIST) || Npc_IsInFightMode(other,FMODE_FAR)))
	{
		if(Npc_IsInFightMode(other,FMODE_MELEE) || Npc_IsInFightMode(other,FMODE_FIST))
		{
			sneakweaponindex = other.attribute[ATR_STRENGTH] + Hlp_Random(other.attribute[ATR_DEXTERITY]);
			if(sneakweaponindex >= self.attribute[ATR_HITPOINTS])
			{
				if(self.aivar[AIV_VictoryXPGiven] == FALSE)
				{
					B_GivePlayerXP(self.level * XP_PER_VICTORY);
					self.aivar[AIV_VictoryXPGiven] = TRUE;
				};
				PrintScreen("Bonus auf Uberraschungsangriff!",-1,-1,FONT_Screen,3);
				self.aivar[AIV_KilledByPlayer] = TRUE;
				self.attribute[ATR_HITPOINTS] = 0;
				AI_StartState(self,ZS_Dead,0,"");
			}
			else
			{
				PrintScreen("Bonus auf Uberraschungsangriff!",-1,-1,FONT_Screen,3);
				Npc_ChangeAttribute(self,ATR_HITPOINTS,-sneakweaponindex);
			};
		}
		else if(Npc_IsInFightMode(other,FMODE_FAR))
		{
			sneakweaponindex = other.attribute[ATR_DEXTERITY] + Hlp_Random(other.attribute[ATR_DEXTERITY]);
			if(sneakweaponindex >= self.attribute[ATR_HITPOINTS])
			{
				if(self.aivar[AIV_VictoryXPGiven] == FALSE)
				{
					B_GivePlayerXP(self.level * XP_PER_VICTORY);
					self.aivar[AIV_VictoryXPGiven] = TRUE;
				};
				PrintScreen("Bonus auf Uberraschungsangriff!",-1,-1,FONT_Screen,3);
				self.aivar[AIV_KilledByPlayer] = TRUE;
				self.attribute[ATR_HITPOINTS] = 0;
				AI_StartState(self,ZS_Dead,0,"");
			}
			else
			{
				PrintScreen("Bonus auf Uberraschungsangriff!",-1,-1,FONT_Screen,3);
				Npc_ChangeAttribute(self,ATR_HITPOINTS,-sneakweaponindex);
			};
		};
	};
	if(Hlp_GetInstanceID(self) == Hlp_GetInstanceID(xardas_goblin))
	{
		if(XARDASGOBLINATTACKED == FALSE)
		{
			XARDASGOBLINATTACKED = TRUE;
		};
		if(XARDASGOBLINHUNT == FALSE)
		{
			return;
		};
	};
	if(Hlp_GetInstanceID(self) == Hlp_GetInstanceID(necromacerzombie))
	{
		B_GhostSpecialDamage(other,self);
	};
	B_BeliarsWeaponSpecialDamage(other,self);
	if(Npc_HasItems(other,Holy_Hammer_MIS) > 0)
	{
		MagGol = Hlp_GetNpc(MagicGolem);
		Npc_GetInvItem(other,Holy_Hammer_MIS);
		OthWeap = Npc_GetReadiedWeapon(other);
		if((Hlp_GetInstanceID(self) == Hlp_GetInstanceID(MagGol)) && (Hlp_GetInstanceID(OthWeap) == Hlp_GetInstanceID(item)))
		{
			Npc_ChangeAttribute(self,ATR_HITPOINTS,-10000);
			B_GivePlayerXP(self.level * XP_PER_VICTORY);
			self.aivar[AIV_VictoryXPGiven] = TRUE;
			return;
		};
	};
	if(Npc_HasItems(other,itrw_holybow) > 0)
	{
		Npc_GetInvItem(other,itrw_holybow);
		OthWeap = Npc_GetReadiedWeapon(other);
		if(C_NpcIsUndead(self) && (Hlp_GetInstanceID(OthWeap) == Hlp_GetInstanceID(item)))
		{
			if(Hlp_GetInstanceID(self) == Hlp_GetInstanceID(Dragon_Undead))
			{
				if(self.attribute[ATR_HITPOINTS] > 1000)
				{
					Npc_ChangeAttribute(self,ATR_HITPOINTS,-1000);
					return;
				};
			}
			else if(self.guild != GIL_DRAGON)
			{
				Npc_ChangeAttribute(self,ATR_HITPOINTS,-10000);
				B_GivePlayerXP(self.level * XP_PER_VICTORY);
				self.aivar[AIV_VictoryXPGiven] = TRUE;
				return;
			};
		};
	};
	if((Npc_HasItems(other,itmw_normardsword) > 0) && (self.guild != GIL_DRAGON))
	{
		ghostex = Hlp_GetNpc(soul_ghost);
		Npc_GetInvItem(other,itmw_normardsword);
		OthWeap = Npc_GetReadiedWeapon(other);
		if((Hlp_GetInstanceID(self) == Hlp_GetInstanceID(ghostex)) && (Hlp_GetInstanceID(OthWeap) == Hlp_GetInstanceID(item)))
		{
			Npc_ChangeAttribute(self,ATR_HITPOINTS,-10000);
			B_GivePlayerXP(self.level * XP_PER_VICTORY);
			self.aivar[AIV_VictoryXPGiven] = TRUE;
			return;
		};
	};
	if((self.guild == GIL_Stoneguardian) && (self.aivar[AIV_EnemyOverride] == TRUE))
	{
		b_awake_stoneguardian(self);
	};
	if(Npc_IsPlayer(other) && (self.guild == GIL_ORC) && (GUARDIANSISDEFEATED == FALSE) && (KAPITELORCATC == TRUE))
	{
		if(Npc_GetDistToWP(other,"NW_CITY_MERCHANT_PATH_11") <= 32000)
		{
			Wld_PlayEffect("spellFX_BELIARSRAGE",hero,hero,0,0,0,FALSE);
			Snd_Play("DEM_Warn");
			Wld_PlayEffect("VOB_MAGICBURN",hero,hero,0,0,0,FALSE);
			if(COUNTORCPROTECT == FALSE)
			{
				hero.attribute[ATR_HITPOINTS] = hero.attribute[ATR_HITPOINTS] / 2;
				COUNTORCPROTECT = TRUE;
			}
			else
			{
				hero.attribute[ATR_HITPOINTS] = 0;
				COUNTORCPROTECT = FALSE;
			};
			if(FIRSTSTRIKEME == FALSE)
			{
				B_GivePlayerXP(500);
				FIRSTSTRIKEME = TRUE;
				if(MIS_STRANGETHINGS == LOG_Running)
				{
					B_LogEntry(TOPIC_STRANGETHINGS,"Ich verstehe uberhaupt nicht, was hier geschieht! Als ich versucht habe, einen Ork anzugreifen, wurde ich von einem Blitz getroffen, der mich fast totete. Allem Anschein nach werden diese Kreaturen durch Magie geschutzt. Ich muss jetzt vorsichtiger werden...");
				}
				else if(MIS_STRANGETHINGS == FALSE)
				{
					MIS_STRANGETHINGS = LOG_Running;
					Log_CreateTopic(TOPIC_STRANGETHINGS,LOG_MISSION);
					Log_SetTopicStatus(TOPIC_STRANGETHINGS,LOG_Running);
					B_LogEntry(TOPIC_STRANGETHINGS,"Hier geschehen ziemlich seltsame Sachen! Als ich versucht habe, einen Ork anzugreifen, wurde ich von einem Blitz getroffen, der mich fast totete. Allem Anschein nach werden diese Kreaturen durch Magie geschutzt. Ich muss jetzt vorsichtiger werden...");
				};
			};
		}
		else if(Npc_GetDistToWP(other,"NW_PATH_TO_MONASTERY_09") <= 12000)
		{
			Wld_PlayEffect("spellFX_BELIARSRAGE",hero,hero,0,0,0,FALSE);
			Snd_Play("DEM_Warn");
			Wld_PlayEffect("VOB_MAGICBURN",hero,hero,0,0,0,FALSE);
			if(COUNTORCPROTECT == FALSE)
			{
				hero.attribute[ATR_HITPOINTS] = hero.attribute[ATR_HITPOINTS] / 2;
				COUNTORCPROTECT = TRUE;
			}
			else
			{
				hero.attribute[ATR_HITPOINTS] = 0;
				COUNTORCPROTECT = FALSE;
			};
			if(FIRSTSTRIKEME == FALSE)
			{
				B_GivePlayerXP(500);
				FIRSTSTRIKEME = TRUE;
				if(MIS_STRANGETHINGS == LOG_Running)
				{
					B_LogEntry(TOPIC_STRANGETHINGS,"Ich verstehe uberhaupt nicht, was hier geschieht! Als ich versucht habe, einen Ork anzugreifen, wurde ich von einem Blitz getroffen, der mich fast totete. Allem Anschein nach werden diese Kreaturen durch Magie geschutzt. Ich muss jetzt vorsichtiger werden...");
				}
				else if(MIS_STRANGETHINGS == FALSE)
				{
					MIS_STRANGETHINGS = LOG_Running;
					Log_CreateTopic(TOPIC_STRANGETHINGS,LOG_MISSION);
					Log_SetTopicStatus(TOPIC_STRANGETHINGS,LOG_Running);
					B_LogEntry(TOPIC_STRANGETHINGS,"Hier geschehen ziemlich seltsame Sachen! Als ich versucht habe, einen Ork anzugreifen, wurde ich von einem Blitz getroffen, der mich fast totete. Allem Anschein nach werden diese Kreaturen durch Magie geschutzt. Ich muss jetzt vorsichtiger werden...");
				};
			};
		}
		else if(Npc_GetDistToWP(other,"NW_BIGFARM_ORC_SAFE") <= 15000)
		{
			Wld_PlayEffect("spellFX_BELIARSRAGE",hero,hero,0,0,0,FALSE);
			Snd_Play("DEM_Warn");
			Wld_PlayEffect("VOB_MAGICBURN",hero,hero,0,0,0,FALSE);
			if(COUNTORCPROTECT == FALSE)
			{
				hero.attribute[ATR_HITPOINTS] = hero.attribute[ATR_HITPOINTS] / 2;
				COUNTORCPROTECT = TRUE;
			}
			else
			{
				hero.attribute[ATR_HITPOINTS] = 0;
				COUNTORCPROTECT = FALSE;
			};
			if(FIRSTSTRIKEME == FALSE)
			{
				B_GivePlayerXP(500);
				FIRSTSTRIKEME = TRUE;
				if(MIS_STRANGETHINGS == LOG_Running)
				{
					B_LogEntry(TOPIC_STRANGETHINGS,"Ich verstehe uberhaupt nicht, was hier geschieht! Als ich versucht habe, einen Ork anzugreifen, wurde ich von einem Blitz getroffen, der mich fast totete. Allem Anschein nach werden diese Kreaturen durch Magie geschutzt. Ich muss jetzt vorsichtiger werden...");
				}
				else if(MIS_STRANGETHINGS == FALSE)
				{
					MIS_STRANGETHINGS = LOG_Running;
					Log_CreateTopic(TOPIC_STRANGETHINGS,LOG_MISSION);
					Log_SetTopicStatus(TOPIC_STRANGETHINGS,LOG_Running);
					B_LogEntry(TOPIC_STRANGETHINGS,"Hier geschehen ziemlich seltsame Sachen! Als ich versucht habe, einen Ork anzugreifen, wurde ich von einem Blitz getroffen, der mich fast totete. Allem Anschein nach werden diese Kreaturen durch Magie geschutzt. Ich muss jetzt vorsichtiger werden...");
				};
			};
		};
	};
	if(C_PredatorFoundPrey(other,self))
	{
		Npc_ClearAIQueue(self);
		Npc_SetTarget(self,other);
		B_ClearPerceptions(self);
		AI_StartState(self,ZS_MM_Flee,0,"");
		return;
	};
	if(Npc_IsInState(self,ZS_MM_Attack))
	{
		if(Npc_IsPlayer(other) && (self.aivar[AIV_PARTYMEMBER] == TRUE))
		{
			return;
		};
		if((self.aivar[AIV_MM_REAL_ID] == ID_SKELETON) && (other.aivar[AIV_MM_REAL_ID] == ID_SKELETON_MAGE))
		{
			return;
		};
		if(Hlp_GetInstanceID(other) != self.aivar[AIV_LASTTARGET])
		{
			if(self.aivar[AIV_HitByOtherNpc] == Hlp_GetInstanceID(other))
			{
				Npc_SetTarget(self,other);
			}
			else
			{
				self.aivar[AIV_HitByOtherNpc] = Hlp_GetInstanceID(other);
			};
		};
		return;
	};
	Npc_ClearAIQueue(self);
	Npc_SetTarget(self,other);
	B_ClearPerceptions(self);
	AI_StartState(self,ZS_MM_Attack,0,"");
};